﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace MODULE_NHAPXUAT
{
    public class cls_nhapxuat
    {
        public System.Windows.Forms.Form parent;
        public static  string strongluong;
        public string getsettrongluong
        {
            get 
            {
                return strongluong;
            }
            set 
            {
                strongluong = value;
            }
        }
        public static nhapxuatDataContext getcontext()
        {
            return new nhapxuatDataContext(getconnectstring());
        }
        public static string getconnectstring()
        {
            string kq = "";
            XmlDocument MyDoc = new XmlDocument();

            MyDoc.Load("extension\\extension.xml");
            XmlNode root = (XmlNode)MyDoc.DocumentElement;

            for (int i = 0; i < root.ChildNodes.Count; i++)
            {
                XmlNode element = (XmlNode)root.ChildNodes[i];
                if (element.Name == "connection")
                {
                    kq = element.Attributes["connectionString"].Value.ToString();
                }
            }
            return kq;

        }
        public void ShowForm(string formname)
        {

            switch (formname)
            {
                case "frm_nhaphang":
                    frm_nhaphang frmnh = new frm_nhaphang();
                    frmnh.MdiParent = parent;
                    frmnh.Show();
                    
                    break;
                case "frm_bancan":
                    frm_bancan frmbc = new frm_bancan();
                    frmbc.MdiParent = parent;
                    frmbc.Show();
                   // bool isshow = true;
                   
                      
                    //    bool isexit = frmbc._ispass;
                    
                    
                    
                     strongluong = frmbc._result;
                    break;
            }
        }

    }
}
